﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Installer.cs" company="Anton Frattaroli">
//   Copyright (c) Anton Frattaroli. All rights reserved.
// </copyright>
// <summary>
//   Defines the Installer IHttpHanlder implementation class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Lidocaine.Service
{
    using System.Web;
    using Lidocaine.BusinessLogic;
    
    /// <summary>
    /// Defines the Installer class.
    /// </summary>
    public class Installer : IHttpHandler
    {
        /// <summary>
        /// Gets a value indicating whether this implementation of IHttpHandler is reusable.
        /// </summary>
        public bool IsReusable
        {
            get { return false; }
        }
        
        /// <summary>
        /// This implementation of IHttpHandler handles one of two asynchronous calls the Lidocaine installation webpage makes.
        /// </summary>
        /// <param name="context">The HttpContext object of the current HTTP request.</param>
        public void ProcessRequest(HttpContext context)
        {
            InstallerManager.Install(context.Request["siteTitle"], context.Request["siteDomain"], context.Request["useAdmin"], context.Request["userName"], context.Request["userPassword"], context.Request["databaseName"], context.Request["databaseServer"]);
        }
    }
}